'## Copyright (c) 2011, Hacker Wez under the New BSD License, see glyphx-license.txt (http://glyphx.codeplex.com/)
Public Class AboutForm

    Private Sub AboutForm_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        lnkSite.Text = SITE_URL
        lnkSite.LinkArea = New LinkArea(0, SITE_URL.Length)
        lblTitle.Text = My.Application.Info.ProductName
        set_versionstring()
        trayIcon.Text = My.Application.Info.ProductName
        Me.Text = My.Application.Info.ProductName
        Me.BackgroundImage = My.Resources.about_icon
        Me.Show()
        My.Forms.canvasForm.Show(Me)
    End Sub

    Sub set_versionstring()
        Dim v As Version = My.Application.Info.Version
        Dim b, r As String
        If (v.Build > 0) Then b = String.Format("build {0}", v.Build)
        If (v.Revision > 0) Then r = String.Format("r{0}", v.Revision)
        lblVersion.Text = String.Format("v {0}.{1} {2}{3}", v.Major, v.Minor, b, r)
    End Sub

    Private Sub AboutForm_MouseClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseClick
        Me.Hide()
    End Sub

    '// about tray menu item
    Private Sub cmiAbout_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmiAbout.Click
        Me.Show()
    End Sub

    '// options tray menu item
    Private Sub cmiOptions_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmiOptions.Click
        optionsForm.Show()
    End Sub

    '// exit tray menu item
    Private Sub cmiExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmiExit.Click
        Me.Close()
    End Sub

    Private Sub tmrClose_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tmrClose.Tick
        tmrClose.Stop()
        Me.Hide()
    End Sub

    Private Sub lnkSite_LinkClicked(ByVal sender As Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles lnkSite.LinkClicked
        Try
            Process.Start(SITE_URL)
        Catch ex As Exception
            MessageBox.Show(ex.Message, "error", MessageBoxButtons.OK, MessageBoxIcon.Error)
        End Try
    End Sub
End Class